// storage.js

// 获取Storage值
export function getStorage(key) {
  return new Promise((resolve, reject) => {
    uni.getStorage({
      key,
      success: res => {
        resolve(res.data);
      },
      fail: err => {
        reject(err);
      }
    });
  });
}

// 设置Storage值
export function setStorage(key, value) {
  console.log("🚀 ~ file: storage.js:20 ~ setStorage ~ key, value:", key, value)
  return new Promise((resolve, reject) => {
    uni.setStorage({
      key,
      data: value,
      success: () => {
        resolve();
      },
      fail: err => {
        reject(err);
      }
    });
  });
}
